package ${package.ServiceImpl};

import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;

import com.softWang.common.base.BaseServiceMy;
import com.softWang.common.exception.LogicException;
import ${package.Entity}.${entity};
import ${package.Mapper}.${table.mapperName};
import ${package.Parent}.vo.${entity?uncap_first}.*;

/**
 * <p>
 * ${table.comment!} 服务实现类
 * </p>
 *
 * @author ${author}
 * @since ${date}
 */
@Service
public class ${entity}Service extends BaseServiceMy<${entity}> {

     @Resource
     private ${table.mapperName} ${table.mapperName?uncap_first};

     /**
     * 分页条件查询
     * @param param
     * @return
     */
     public List<${entity}QueryAllResult> queryall(${entity}QueryAllParam param){
         param.startPage();
         List<${entity}QueryAllResult> results=${table.mapperName?uncap_first}.queryall(param);
         return results;
     }

      /**
      * 插入
      * @param param 数据信息
      * @return id
      */
      @Transactional
      public Long add(${entity}AddParam param) {

          ${entity} entity = new ${entity}();
          BeanUtils.copyProperties(param, entity);

          ${table.mapperName?uncap_first}.insert(entity);
          return entity.getId();
      }

      /**
      * 修改
      * @param param  数据信息
      * @return
      */
      @Transactional
      public Long edit(${entity}EditParam param) {

         ${entity} entity = new ${entity}();
         BeanUtils.copyProperties(param, entity);

         ${table.mapperName?uncap_first}.updateById(entity);
         return entity.getId();
      }

      /**
      * 获取详情
      * @param id id
      * @return 详情信息
      */
      public ${entity} getById(Long id) {
           return ${table.mapperName?uncap_first}.selectById(id);
      }

      /**
      * 删除
      * @param ids id列表
      * @return void
      */
      @Transactional
      public void del(List<Long> ids) {
          ${table.mapperName?uncap_first}.deleteBatchIds(ids);
      }

}
